import { request } from "@/utils/request.js"
import constructionViewMockData from "@/mock/data/construction/index.js"

function query(mockDataName) {
    const { integrationData, catalog } = constructionViewMockData;
    const { data: result } = integrationData[catalog.indexOf(mockDataName)];
    return { data: result }
}

/**
 * 应用健康
 * @param {} options 
 * @returns 
 */
export function getAppHealthData(options = {}) {
    return request({
        url: `sjzt/yyjs/yyjk`,
        method: 'get',
        mockFilter: (req, mockDataName = "yyjk") => {
            return query(mockDataName)
        },
        params: options
    })

}

/**
 * 应用工单TOP5
 * @param {} options 
 * @returns 
 */
export function getAppWorkData(options = {}) {
    return request({
        url: `sjzt/yyjs/yygd`,
        method: 'get',
        mockFilter: (req, mockDataName = "yygd") => {
            return query(mockDataName)
        },
        params: options
    })

}

/**
 * 需求停留天数
 * @param {*} options 
 * @returns 
 */
export function demandDateTime(options = {}) {
    return request({
        url: `sjzt/yyjs/xqtlts`,
        method: 'get',
        mockFilter: (req, mockDataName = "xqtlts") => {

            return query(mockDataName)
        },
        params: options
    })

}

/**
 * 查看代码详情
 * @param {*} options 
 * @returns 
 */
export function codeDateDetails(options = {}) {
    return request({
        url: `sjzt/yyjs/dmtjzl`,
        method: 'get',
        mockFilter: (req, mockDataName = "dmtjzl") => {

            return query(mockDataName)
        },
        params: options
    })

}